#include <stdio.h>
#include <math.h>

//resolution in bits (12 bits or 14 bits)
float tempSensirion(unsigned char resolution, unsigned short rawTemperature)
{
	float tempSensirion;
	float d1 = -40.0,d2; //d1 este -40.0 doar pentru VDD = 5v
	if (resolution == 14) //resolution: 14 bit
		d2 = 0.01;
	else
		d2 = 0.04;
	tempSensirion = d1 + d2 * rawTemperature;
	return tempSensirion;
}

void main(void)
{
unsigned int rawTemperature;
printf("rawTemperature (12b - max. 4096) = ");
scanf("%d",&rawTemperature);

printf("Temperatura = %.2f",tempSensirion(12,rawTemperature));

}